﻿
Partial Class store_UCSermon2
    Inherits System.Web.UI.UserControl

    Public Sub Display(p As CProduct)
        If Me.Parent.Controls.Count Mod 2 = 1 Then row.Attributes.Add("class", "alt_row")

        With lnkDate
            .Text = p.ProductCreated.ToString("d-MMM-yy")
            .ToolTip = p.DateString()
            .NavigateUrl = CSitemap.Decide(p)
        End With

        With lnkSermon
            .Text = p.ProductName
            .NavigateUrl = CSitemap.Decide(p)
            .ToolTip = p.ProductDescription
        End With
        With lnkNameChineseSimplified
            If p.IsEnglish Then
                .Visible = False
            Else
                .Text = p.ProductNameChineseSimplified
                .ToolTip = p.ProductDescriptionChineseSimplified
            End If
        End With

        With lnkSpeaker
            .ToolTip = p.Speaker.NameAndCountActive
            .Text = CUtilities.Truncate(p.SpeakerName, 12)
            .NavigateUrl = CSitemap.Sermons(Nothing, p.ProductSpeakerId, 0)
        End With

        With lnkDeaf
            .Visible = p.HasTranscript
            .NavigateUrl = CSitemap.TranscriptWithPaging(p)
        End With

        With lnkAudio
            If p.HasAudio Then
                Dim mp3 As CFile = p.Files.FirstMp3
                .NavigateUrl = CConfig.DropboxUrl(mp3.FileName)
                .ToolTip = CUtilities.FileSize(mp3.FileSize) & vbCrLf & mp3.FileNameShort & vbCrLf & CUtilities.Truncate(p.ProductDescription, 500)
            Else
                .Visible = False
            End If
        End With

        With lnkNotes
            If p.HasNotes Then
                .Visible = True
                .NavigateUrl = CSitemap.Decide(p) & "#notes"
            End If
        End With

        With lnkVideo
            If p.HasVideos Then
                .NavigateUrl = CSitemap.Decide(p) & "#video"
                .Visible = True
            End If
        End With

    End Sub

End Class
